const { SerialPort } = require('serialport')

// 串口配置
const portConfig = {
    path: 'COM1',
    baudRate: 9600,
    autoOpen: true,
    dataBits: 8
}
// 创建串口实例
const serialport = new SerialPort(portConfig)
serialport.open(()=>{
    console.log('Serial port opened')
    // this._serialport.write('ROBOT POWER ON')//向串口发送数据
    serialport.on('data', (data) => {//接收数据
        console.log('Serial data:', data)
    })
})

